/*
 * SwingMetaObject.h  0.4.0 / Nov 17, 2010
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
#ifndef SWINGMETAOBJECT_H
#define SWINGMETAOBJECT_H

#include "Cute4jCore.h"

// SwingMetaObject Class. ------------------------------------------------------

/*!
 * \brief Swing Meta Object.
 *
 * \author Slobodan Vrkacevic
 * \version 0.4.0
 */
class CUTE4J_EXPORT SwingMetaObject : public QObject
{
  Q_OBJECT
private:
  SwingMetaObject();
  SwingMetaObject(const SwingMetaObject &);
  ~SwingMetaObject();
public:
  static void initialize();
  static bool invokeMember(QObject *obj, const char *member, const char *type,
                           void *ret, QGenericArgument *val0,
                           QGenericArgument *val1, QGenericArgument *val2,
                           QGenericArgument *val3, QGenericArgument *val4,
                           QGenericArgument *val5, QGenericArgument *val6,
                           QGenericArgument *val7, QGenericArgument *val8,
                           QGenericArgument *val9);
  static bool invokeStaticMember(int classID, int methodID, const char *type,
                                 void *ret, QGenericArgument *val0,
                                 QGenericArgument *val1, QGenericArgument *val2,
                                 QGenericArgument *val3, QGenericArgument *val4,
                                 QGenericArgument *val5, QGenericArgument *val6,
                                 QGenericArgument *val7, QGenericArgument *val8,
                                 QGenericArgument *val9);
  static bool invokeStaticMember(int classID, int methodID,
                                 QGenericArgument val0 = QGenericArgument(),
                                 QGenericArgument val1 = QGenericArgument(),
                                 QGenericArgument val2 = QGenericArgument(),
                                 QGenericArgument val3 = QGenericArgument(),
                                 QGenericArgument val4 = QGenericArgument(),
                                 QGenericArgument val5 = QGenericArgument(),
                                 QGenericArgument val6 = QGenericArgument(),
                                 QGenericArgument val7 = QGenericArgument(),
                                 QGenericArgument val8 = QGenericArgument(),
                                 QGenericArgument val9 = QGenericArgument());
private:
  struct MemberFrame {
    bool succeed;
    QGenericReturnArgument *ret;
    QGenericArgument *val0;
    QGenericArgument *val1;
    QGenericArgument *val2;
    QGenericArgument *val3;
    QGenericArgument *val4;
    QGenericArgument *val5;
    QGenericArgument *val6;
    QGenericArgument *val7;
    QGenericArgument *val8;
    QGenericArgument *val9;
  };
  struct InvokeMemberFrame : MemberFrame {
    QObject *obj;
    const char *member;
  };
  struct InvokeStaticMemberFrame : MemberFrame {
    int classID;
    int methodID;
  };
private:
  void invokeMember(InvokeMemberFrame *frame);
  void invokeStaticMember(InvokeStaticMemberFrame *frame);
private slots:
  void invokeMemberSlot(InvokeMemberFrame *frame);
  void invokeStaticMemberSlot(InvokeStaticMemberFrame *frame);
signals:
  void invokeMemberSignal(InvokeMemberFrame *frame);
  void invokeStaticMemberSignal(InvokeStaticMemberFrame *frame);
private:
  static SwingMetaObject *sm_instance;
private:
  friend class OptionPaneDelegate; // uses the following fields
    static const int OptionPaneDelegate_classID = 0;
    static const int OptionPaneDelegate_showMessage_methodID = 0;
  friend class WindowDelegate; // uses the following fields
    static const int WindowDelegate_classID = 1;
    static const int WindowDelegate_getWindows_methodID = 0;
    static const int WindowDelegate_getActiveWindow_methodID = 1;
    static const int WindowDelegate_setWindowOwner_methodID = 2;
  friend class ColorChooserDelegate; // uses the following fields
    static const int ColorChooserDelegate_classID = 2;
    static const int ColorChooserDelegate_getColor_methodID = 0;
  friend class FontChooserDelegate; // uses the following fields
    static const int FontChooserDelegate_classID = 3;
    static const int FontChooserDelegate_getFont_methodID = 0;
  friend class FileChooserDelegate; // uses the following fields
    static const int FileChooserDelegate_classID = 4;
    static const int FileChooserDelegate_getExistingDirectoryName_methodID = 0;
    static const int FileChooserDelegate_getOpenFileName_methodID = 1;
    static const int FileChooserDelegate_getSaveFileName_methodID = 2;
  friend class ToolTipDelegate; // uses the following fields
    static const int ToolTipDelegate_classID = 5;
    static const int ToolTipDelegate_setFont_methodID = 0;
    static const int ToolTipDelegate_setBackground_methodID = 1;
    static const int ToolTipDelegate_setNullBackground_methodID = 2;
    static const int ToolTipDelegate_setForeground_methodID = 3;
    static const int ToolTipDelegate_setNullForeground_methodID = 4;
    static const int ToolTipDelegate_showText_methodID = 5;
    static const int ToolTipDelegate_hideText_methodID = 6;
  friend class WhatsThisManagerDelegate; // uses the following fields
    static const int WhatsThisManagerDelegate_classID = 6;
    static const int WhatsThisManagerDelegate_showText_methodID = 0;
    static const int WhatsThisManagerDelegate_hideText_methodID = 1;
    static const int WhatsThisManagerDelegate_isInWhatsThisMode_methodID = 2;
    static const int WhatsThisManagerDelegate_enterWhatsThisMode_methodID = 3;
    static const int WhatsThisManagerDelegate_exitWhatsThisMode_methodID = 4;
  friend class SwingImageDelegate; // uses the following fields
    static const int SwingImageDelegate_classID = 7;
    static const int SwingImageDelegate_createImage_methodID = 0;
    static const int SwingImageDelegate_createImageOBAI_methodID = 1;
    static const int SwingImageDelegate_createScaled_methodID = 2;
  friend class DesktopDelegate; // uses the following fields
    static const int DesktopDelegate_classID = 8;
    static const int DesktopDelegate_getScreenSize_methodID = 0;
    static const int DesktopDelegate_getScreenResolution_methodID = 1;
    static const int DesktopDelegate_getDesktopBounds_methodID = 2;
    static const int DesktopDelegate_takeScreenshot_methodID = 3;
};

#endif // SWINGMETAOBJECT_H
